package constructor;
//构造器的应用.
public class student {
    String name;
    int score;
    //构造器设定,与方法的定义差不多,不用写返回类型
    public student() { //无参数构造器
        System.out.println("引用无参构造器");
    }

    public student(String name,int score) {//有参数构造器
        System.out.println("引用有参构造器");
        //引用时直接给成员赋值
        this.name = name;
        this.score = score;
    }
}
